package practice;

import java.util.*;

public class _19FindPy {
    static int T;
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        T = scanner.nextInt();
        while(T-- > 0){
            int n,m,k;
            n = scanner.nextInt();
            m = scanner.nextInt();
            k = scanner.nextInt();

            Set<int[]> set = new HashSet<>();
            while(k-- > 0){
                int[] xy = new int[2];
                xy[0] = scanner.nextInt();
                xy[1] = scanner.nextInt();
                set.add(xy);
            }
            List<int[]> list = new ArrayList<>(set);
            list.sort(new Comparator<int[]>() {
                @Override
                public int compare(int[] o1, int[] o2) {
                    return (o1[0]+o1[1]) - (o2[0]+o2[1]);
                }
            });
            int res = 0;
            for (int i = 0;i < list.size()-1;i++){
                int[] xy1 = list.get(i);
                int[] xy2 = list.get(i+1);
                if (xy1[0] <= xy2[0] && xy1[1] <= xy2[1]){
                    res++;
                }
            }
            if (res == list.size()-1){
                System.out.println("YES");
            }else {
                System.out.println("NO");
            }
        }
    }

}
